package admin.service.impl;

import admin.entity.Role;
import admin.mapper.RoleMapper;
import admin.service.RoleService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;

/**
 * @author xf07b1
 * @wechat xf07b1
 * @description
 */
@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {

    @Override
    public void page( Page<Role> page,Role role) {
        LambdaQueryWrapper<Role> wrapper = Wrappers.lambdaQuery(Role.class)
                .eq(!ObjectUtils.isEmpty(role.getId()), Role::getId, role.getId())
                .like(!ObjectUtils.isEmpty(role.getName()), Role::getName, role.getName());
        this.page(page,wrapper);
    }
}
